package common.simulation.scenarios;

import common.simulation.scenarios.Operations;
import se.sics.kompics.p2p.experiment.dsl.SimulationScenario;

@SuppressWarnings("serial")
public class ScenarioTask3 extends Scenario {
	private static SimulationScenario scenario = new SimulationScenario() {{
		StochasticProcess process1 = new StochasticProcess() {{
			eventInterArrivalTime(constant(100));
			raise(1, Operations.peerJoin(5), uniform(13));
		}};
		
		StochasticProcess process2 = new StochasticProcess() {{
			eventInterArrivalTime(constant(100));
			raise(99, Operations.peerJoin(5), uniform(13));
		}};

                //added
                StochasticProcess process3 = new StochasticProcess() {{
                        eventInterArrivalTime(constant(100));
                        raise(5, Operations.eventSubscribe, uniform(13));
                }};
                
                //added
                StochasticProcess process4 = new StochasticProcess() {{
                        eventInterArrivalTime(constant(1));
                        raise(1, Operations.eventPublish, uniform(13));
                }};             
                
                /*StochasticProcess process5 = new StochasticProcess() {{
			eventInterArrivalTime(constant(1));
			raise(1, Operations.publish);
		}};*/

		process1.start();
		process2.startAfterTerminationOf(2000, process1);
                process3.startAfterTerminationOf(20000, process2);     //added
                process4.startAfterTerminationOf(80000, process3);     //added
                //process5.startAfterTerminationOf(2000, process3);
	}};
	
//-------------------------------------------------------------------
	public ScenarioTask3() {
		super(scenario);
	} 
}
